widget: Implement new GtkAccessible vfuncs
authorLukáš Tyrychtr <lukastyrychtr@gmail.com>
Fri, 9 Sep 2022 15:02:59 +0000 (17:02 +0200)
committerEmmanuele Bassi <ebassi@gnome.org>
Fri, 3 Feb 2023 10:49:17 +0000 (11:49 +0100)
gtk/gtkwidget.c

index 72582aeb6ad193346d77945b01538ce7a38d3513..c842d1f7a59da5c4a7c57faab322c93b1b45e2ad 100644 (file)
@@ -8465,11 +8465,35 @@ gtk_widget_accessible_get_platform_state (GtkAccessible              *self,
     }
 }
 
+static GtkAccessible *
+gtk_widget_accessible_get_parent (GtkAccessible *self)
+{
+  return GTK_ACCESSIBLE (gtk_widget_get_parent (GTK_WIDGET (self)));
+}
+
+static GtkAccessible *
+gtk_widget_accessible_get_child_at_index (GtkAccessible *self, guint index)
+{
+  guint idx = 0;
+  GtkWidget *child;
+  for (child = gtk_widget_get_first_child (GTK_WIDGET (self));
+               child != NULL;
+               child = gtk_widget_get_next_sibling (child))
+    {
+      if (idx == index)
+        return GTK_ACCESSIBLE (child);
+      idx++;
+    }
+  return NULL;
+}
+
 static void
 gtk_widget_accessible_interface_init (GtkAccessibleInterface *iface)
 {
   iface->get_at_context = gtk_widget_accessible_get_at_context;
   iface->get_platform_state = gtk_widget_accessible_get_platform_state;
+  iface->get_parent = gtk_widget_accessible_get_parent;
+  iface->get_child_at_index = gtk_widget_accessible_get_child_at_index;
 }
 
 static void